// routes.ts
import {
    GAME_READY,
    GAME_ENTER_ROOM,
    GAME_LEAVE_ROOM,
    GAME_FIGHT_RECONNECT,
    GAME_INVITE_FRIEND,
    GAME_BROADCAST_TEAM
} from 'yiqiyoosdk-types'

export const ROUTES = {
    gameReady: GAME_READY,
    gameEnterRoom: GAME_ENTER_ROOM,
    gameLeaveRoom: GAME_LEAVE_ROOM,
    gameFightReconnect: GAME_FIGHT_RECONNECT,
    gameInviteFriend: GAME_INVITE_FRIEND,
    gameBroadcastTeam: GAME_BROADCAST_TEAM,
} as const

export type BridgePayloads = {
    gameReady: void
    gameEnterRoom: { roomId: string; exp: string }
    gameLeaveRoom: { roomId: string }
    gameFightReconnect: void
    gameInviteFriend: { roomId: string; gameId: string }
    gameBroadcastTeam: { roomId: string; mode: string }
}



// 自动生成接口类型，用于 IDE 补全
type BridgeMethod<T> = T extends void ? () => void : (payload: T) => void;

export type BridgeClientMethods = {
    [K in keyof BridgePayloads]: BridgeMethod<BridgePayloads[K]>;
};


